package com.cha.chaCommon.core.common;

/*
@Author  hkf
@date 2024/9/23
--轻舟已过万重山--
*/
public class R {
    private Integer code;
    private String msg;
    private Object data;
    public static R ok(Object data){
        return new R(200,"ok",data);
    }
    public static R ok(){
        return new R(200,"ok",null);
    }
    public static R fail(){
        return new R(500,"fail",null);
    }
    public static R fail(Integer code,String msg){
        return new R(code,msg,null);
    }
    public static R fail(String msg){
        return new R(500,msg,null);
    }

    public R() {
    }

    public R(Integer code, String msg, Object data) {
        this.code = code;
        this.msg = msg;
        this.data = data;
    }

    /**
     * 获取
     * @return code
     */
    public Integer getCode() {
        return code;
    }

    /**
     * 设置
     * @param code
     */
    public void setCode(Integer code) {
        this.code = code;
    }

    /**
     * 获取
     * @return msg
     */
    public String getMsg() {
        return msg;
    }

    /**
     * 设置
     * @param msg
     */
    public void setMsg(String msg) {
        this.msg = msg;
    }

    /**
     * 获取
     * @return data
     */
    public Object getData() {
        return data;
    }

    /**
     * 设置
     * @param data
     */
    public void setData(Object data) {
        this.data = data;
    }

    public String toString() {
        return "R{code = " + code + ", msg = " + msg + ", data = " + data + "}";
    }
}
